<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php include("db.php"); 	// Connect to the database server
dbConnect('kar_web1');   	// Use function in db.php to connect
include_once("http://02d2e0a.netsolhost.com/includes/timeout.php");?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Kalamazoo Animal Rescue</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php include("http://02d2e0a.netsolhost.com/includes/head.inc");  ?>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<div id="bodywidth">
<?php include("http://02d2e0a.netsolhost.com/includes/header.inc");  ?>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<?php include("http://02d2e0a.netsolhost.com/includes/leftmenu.inc");
if (!isset($_SESSION['name']))
{ ?>
<div id="centercontent" style="width: 475px; height: auto">
<form method="GET" action="confirmlogin.php">
<table height="300px" width="100%" border=0 >
	<td align= center valign="top">
		<table height="300px" width="100%" border=0>
			<td align="center">
				<table width="100%" border=0>
				<td align="center">
				<font size=6>KAR Volunteer and Admin Login</font>
				</td>
			</td>
		</table>

		<br>

		<table width="400px" cellpadding="5%" border="0">
		<tr>
			<td align=right><font size=3><b>User Name:</b></font></td /align>
			<td><input type="text" name="user" size="20"></td>
		</tr>
		<tr>
			<td align=right><font size=3><b>Password:</b></td /align>
			<td><input type="password" name="password" size="20"></td>
		</tr>
		</table>

		<table width="100%" border="0">
		<tr>
			<td align=center><input type="submit" value="Login">
			
		</tr>
		</table>
	</td>
</table>
</div>
<? include("http://02d2e0a.netsolhost.com/includes/footer.inc");  ?>
</div>
</body>
</html>
<?php 
}
elseif ((isset($_SESSION['name']) && ($_SESSION['board']!='y')) || (isset($_SESSION['name']) && ($_SESSION['webteam']!='y')))
{ ?>
<div id="centercontent" style="width: 475px; height: auto">
You do not have sufficient privilages to access this page.
</div>
<? include("http://02d2e0a.netsolhost.com/includes/footer.inc");  ?>
</div>
</div>
</body>
</html>
<?
}
else
{ ?>
<div id="centercontent" style="width: 475px; height: auto">
<H2 align=center>Edit User for Web Site Database</H2>
<p style="margin-left:10px;">Use <a href="http://www.mozilla.com/en-US/">Mozilla Firefox</a> for fastest and best rendering of this form.</p>
<BR CLEAR=ALL>
<?php
// Check to see if a volunteer id was passed
if (isset($_GET['ID'])):
	$user_edit = @mysql_query("SELECT * FROM volunteers WHERE volunteers.volunteer_id='$_GET[ID]'");
	
	if (!$user_edit) 
	{
		echo("<p>Error performing query: " . mysql_error() . "</p>");
		 exit();	
	}

	while ( $row = mysql_fetch_array($user_edit) ) 
	{   
		$volunteer_id = $row["volunteer_id"];		// vol id number
		$name = $row["name"];	// name
		$address = $row["address"];
		$email = $row["email"];
		$phone1 = $row["phone1"];
		$phone2 = $row["phone2"];
		$active = $row["active"];
		$picture = $row["picture"];
		$login = $row["login"];
		$password = $row["password"];
		$general = $row["general"];
		$cat_foster = $row["cat_foster"];
		$dog_foster = $row["dog_foster"];
		$cat_screener = $row["cat_screener"];
		$dog_screener = $row["dog_screener"];
		$webteam = $row["webteam"];
		$board = $row["board"];
	}
endif;
?>

<form enctype="multipart/form-data"  action="postuser.php" method="post">
<fieldset style="width:42em;"> 
<legend>User Details</legend>
<p><label for="name">Name: </label><input type="text" id="name"  name="name" value="<?php echo $name;?>"><br /><br /></p>

<p><label for="volunteer_ID">Volunteer ID: </label><input type="text" readonly="readonly" id="volunteer_ID" name="volunteer_ID" value="<?php echo $volunteer_id;?>">
<br /><br /></p>

<p><label for="address">Address: </label><input type="text" id="address" name="address" value="<?php echo $address;?>">
<br /><br /></p>

<p><label for="email">E-Mail: </label><input type="text" id="email" name="email" value="<?php echo $email;?>">
<br /><br /></p>

<p><label for="phone1">Primary Phone: </label><input type="text" id="phone1" name="phone1" value="<?php echo $phone1;?>">
<br /><br /></p>

<p><label for="phone2">Secondary Phone: </label><input type="text" id="phone2" name="phone2" value="<?php echo $phone2;?>">
<br /><br /></p>

<p><label for="active">Active: </label>
<select id="active" name="active" class="bodytext">
<option value='y' selected=\"selected\">Yes</option>
<option value='n' <?php if ($active == 'n') echo("selected=\"selected\"");?>>No</option>
</select><BR/><br /></p>

<p><label for="login">Login: </label><input type="text" id="login" name="login" value="<?php echo $login;?>">
<br /><br /></p>

<fieldset style="width:40em;">
<legend>Check All That Apply</legend>
<div style="width:20em;float:left;">
            <p class="chkbox"><label for="cat_foster">Cat Foster </label>
	<input type="checkbox"  class="boxes" <?php if ($cat_foster =='y') echo("CHECKED");?> id="cat_foster" name="cat_foster" value="1" />
              <br /></p>
              
			<p class="chkbox"><label for="dog_foster">Dog Foster</label>
	<input type="checkbox" class="boxes" <?php if ($dog_foster =='y') echo("CHECKED");?> id="dog_foster" name="dog_foster" value="1" >
              <br /></p>
 
            <p class="chkbox"><label for="cat_screener">Cat Screener</label>
	<input type="checkbox" class="boxes" <?php if ($cat_screener =='y') echo("CHECKED");?> id="cat_screener" name="cat_screener" value="1" >
              <br /></p>
 
            <p class="chkbox"><label for="dog_screener">Dog Screener</label>
	<input type="checkbox" class="boxes" <?php if ($dog_screener =='y') echo("CHECKED");?> id="dog_screener" name="dog_screener" value="1" >
              <br /></p>
			  
            <p class="chkbox"><label for="webteam">Web Team</label>
	<input type="checkbox" class="boxes" <?php if ($webteam =='y') echo("CHECKED");?> id="webteam" name="webteam" value="1" >
              <br /></p>			  
			  
			<p class="chkbox"><label for="board">Board Member</label>
	<input type="checkbox" class="boxes" <?php if ($board =='y') echo("CHECKED");?> id="board" name="board" value="1" >
              <br /></p>			  			
</div>
</fieldset >
<CENTER>
<input type="submit" name="submitpet" value="Submit" />
</CENTER>
</form>
</div> <!-- To close div before first fieldset -->
<? include("http://02d2e0a.netsolhost.com/includes/footer.inc");  ?>
</div>
</body>
</html>
<? } ?>